package com.igeekhome.service.impl;

import com.igeekhome.mapper.SysPermissionMapper;
import com.igeekhome.pojo.SysPermission;
import com.igeekhome.service.ISyspermissionService;
import com.igeekhome.units.ListForm;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class SysprtmissionServiceImpl implements ISyspermissionService {
    @Resource
    private SysPermissionMapper sysPermissionMapper;
    @Override
    public List<ListForm> listForm() {
        List<ListForm> list = new ArrayList<>();
        List<SysPermission> sysPermissions = sysPermissionMapper.selectAll();
        for (SysPermission s : sysPermissions) {
         list.add(new ListForm().setTitle(s.getName()).setIcon(s.getIcon()).setHref(s.getUrl()).setSpread(false)) ;
        }
        return list;
    }
}
